package com.hz.user.interfaces.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hz.base.beans.vo.CommonResult;
import com.hz.base.beans.vo.PageEntity;
import com.hz.base.beans.vo.QueryParams;
import com.hz.beans.code.HzOperateCode;
import com.hz.beans.user.entity.BaseIdentity;
import com.hz.common.beans.constant.DemoResult;
import com.hz.interfaces.user.inf.IBaseIdentityInterface;
import com.hz.user.service.inf.IBaseIdentityService;

/**
 * IBaseIdentityService
 * @author liul
 * @since [0.0.1]
 * @version [0.0.1,2018年07月27日]
 */
@Service("baseIdentityInterface")
public class BaseIdentityInterface implements IBaseIdentityInterface{
	
	@Autowired
	private IBaseIdentityService baseIdentityService;
	

	@Override
	public CommonResult<BaseIdentity> queryBaseIdentity(Long id) {
		CommonResult<BaseIdentity> cr = new DemoResult<>();
		cr = baseIdentityService.selectByPrimaryKey(cr,id);
		cr.setOperate(HzOperateCode.QUERY_BASEIDENTITY);
		return cr;
	}

	@Override
	public CommonResult<BaseIdentity> addBaseIdentity(BaseIdentity baseIdentity) {
		CommonResult<BaseIdentity> cr = new DemoResult<>();
		cr = baseIdentityService.insert(cr, baseIdentity);
		cr.setOperate(HzOperateCode.ADD_BASEIDENTITY);
		return cr;
	}
	
	@Override
	public CommonResult<PageEntity> queryForPage(QueryParams<BaseIdentity> queryParams) {
		CommonResult<PageEntity> cr = new DemoResult<>();
		cr = baseIdentityService.queryForPage(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_BASEIDENTITY_PAGE);
		return cr;
	}

	@Override
	public CommonResult<List<BaseIdentity>> queryBaseIdentityList(QueryParams<BaseIdentity> queryParams) {
		CommonResult<List<BaseIdentity>> cr = new DemoResult<>();
		cr = baseIdentityService.queryForList(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_BASEIDENTITY_LIST);
		return cr;
	}

	@Override
	public CommonResult<BaseIdentity> updateBaseIdentity(BaseIdentity baseIdentity) {
		CommonResult<BaseIdentity> cr = new DemoResult<>();
		cr = baseIdentityService.updateByPrimaryKey(cr, baseIdentity);
		cr.setOperate(HzOperateCode.UPDATE_BASEIDENTITY);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteBaseIdentityArray(Long[] ids) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = baseIdentityService.deleteObjectArray(cr, ids);
		cr.setOperate(HzOperateCode.DELETE_BASEIDENTITY);
		return cr;
	}

	@Override
	public CommonResult<BaseIdentity> insertSelective(BaseIdentity baseIdentity) {
		CommonResult<BaseIdentity> cr = new DemoResult<>();
		cr = baseIdentityService.insertSelective(cr, baseIdentity);
		cr.setOperate(HzOperateCode.INSERTSELECTIVE_BASEIDENTITY);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteByList(List<BaseIdentity> baseIdentityList) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = baseIdentityService.deleteByList(cr, baseIdentityList);
		cr.setOperate(HzOperateCode.DELETELIST_BASEIDENTITY);
		return cr;
	}

	@Override
	public CommonResult<List<BaseIdentity>> batchUpdate(List<BaseIdentity> baseIdentityList) {
		CommonResult<List<BaseIdentity>> cr = new DemoResult<>();
		cr = baseIdentityService.batchUpdate(cr, baseIdentityList);
		cr.setOperate(HzOperateCode.BATCHUPDATE_BASEIDENTITY);
		return cr;
	}

	@Override
	public CommonResult<List<BaseIdentity>> batchSave(List<BaseIdentity> baseIdentityList) {
		CommonResult<List<BaseIdentity>> cr = new DemoResult<>();
		cr = baseIdentityService.batchSave(cr, baseIdentityList);
		cr.setOperate(HzOperateCode.BATCHSAVE_BASEIDENTITY);
		return cr;
	}

}
